/*LICENSE_BEGIN
 * ******************************************************************
 * Copyright 2006 by the Dainamite Robocup-Team at the
 * DAI-Labor, TU-Berlin (www.dai-labor.de)
 * 
 * Members of Dainamite are:
 * Holger Endert
 * Robert Wetzker
 * Thomas Karbe
 * Axel Heßler
 * Philippe Bütter
 * Felix Brossmann
 * 
 * Licensed under the GNU GPL (General Public License) Free Software 
 * License, Version 2. You may use this file only in compliance with 
 * the License. You may obtain a copy of the License at:
 * 
 * http://www.fsf.org/licensing/licenses/gpl.txt
 * ******************************************************************
LICENSE_END*/
package robocup.component.speechacts.coachlanguage;

import java.util.LinkedList;

public class Rule {

	// private String ruleName = "";

	private Condition condition = null;

	private IdList idList = null;

	private LinkedList<Directive> directiveList = new LinkedList<Directive>();

	private LinkedList<Rule> ruleList = new LinkedList<Rule>();

	public void addDirective(Directive direc) {
		directiveList.add(direc);
	}

	public void addRule(Rule rule) {
		ruleList.add(rule);
	}

	public Condition getCondition() {
		return condition;
	}

	public void setCondition(Condition condition) {
		this.condition = condition;
	}

	public LinkedList<Directive> getDirectiveList() {
		return directiveList;
	}

	public void setDirectiveList(LinkedList<Directive> directiveList) {
		this.directiveList = directiveList;
	}

	public LinkedList<Rule> getRuleList() {
		return ruleList;
	}

	public void setRuleList(LinkedList<Rule> ruleList) {
		this.ruleList = ruleList;
	}

	// public String getRuleName() {
	// return ruleName;
	// }
	//
	// public void setRuleName(String ruleName) {
	// this.ruleName = ruleName;
	// }

	public IdList getIdList() {
		return idList;
	}

	public void setIdList(IdList idList) {
		this.idList = idList;
	}

	public String toString() {

		if (this.idList == null) {
			StringBuffer buf = new StringBuffer();

			buf.append(" (" + this.condition.toString());

			for (Directive dir : this.directiveList)
				buf.append(dir.toString());

			for (Rule ru : this.ruleList)
				buf.append(ru.toString());

			buf.append(")");

			return buf.toString();
		} else
			return this.idList.toString();

	}

}
